:root,
:host {
  --van-calendar-background: var(--van-background-2);
  --van-calendar-popup-height: 80%;
  --van-calendar-header-shadow: 0 2px 10px rgba(125, 126, 128, 0.16);
  --van-calendar-header-title-height: 44px;
  --van-calendar-header-title-font-size: var(--van-font-size-lg);
  --van-calendar-header-subtitle-font-size: var(--van-font-size-md);
  --van-calendar-header-action-width: 28px;
  --van-calendar-header-action-color: var(--van-text-color);
  --van-calendar-header-action-disabled-color: var(--van-text-color-3);
  --van-calendar-weekdays-height: 30px;
  --van-calendar-weekdays-font-size: var(--van-font-size-sm);
  --van-calendar-month-title-font-size: var(--van-font-size-md);
  --van-calendar-month-mark-color: rgba(242, 243, 245, 0.8);
  --van-calendar-month-mark-font-size: 160px;
  --van-calendar-day-height: 64px;
  --van-calendar-day-font-size: var(--van-font-size-lg);
  --van-calendar-day-margin-bottom: 4px;
  --van-calendar-day-disabled-color: var(--van-text-color-3);
  --van-calendar-range-edge-color: var(--van-white);
  --van-calendar-range-edge-background: var(--van-primary-color);
  --van-calendar-range-middle-color: var(--van-primary-color);
  --van-calendar-range-middle-background-opacity: 0.1;
  --van-calendar-selected-day-size: 54px;
  --van-calendar-selected-day-color: var(--van-white);
  --van-calendar-selected-day-background: var(--van-primary-color);
  --van-calendar-info-font-size: var(--van-font-size-xs);
  --van-calendar-info-line-height: var(--van-line-height-xs);
  --van-calendar-confirm-button-height: 36px;
  --van-calendar-confirm-button-margin: 7px 0;
}

.van-theme-dark {
  --van-calendar-month-mark-color: rgba(100, 101, 102, 0.2);
  --van-calendar-day-disabled-color: var(--van-gray-7);
}

.van-calendar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--van-calendar-background);

  &__popup {
    &.van-popup--top,
    &.van-popup--bottom {
      height: var(--van-calendar-popup-height);
    }

    &.van-popup--left,
    &.van-popup--right {
      height: 100%;
    }

    .van-popup__close-icon {
      top: 11px;
    }
  }

  &__header {
    flex-shrink: 0;
    box-shadow: var(--van-calendar-header-shadow);
  }

  &__month-title,
  &__header-title,
  &__header-subtitle {
    color: var(--van-text-color);
    height: var(--van-calendar-header-title-height);
    font-weight: var(--van-font-bold);
    line-height: var(--van-calendar-header-title-height);
    text-align: center;
  }

  &__header-title {
    font-size: var(--van-calendar-header-title-font-size);
  }

  &__header-subtitle {
    font-size: var(--van-calendar-header-subtitle-font-size);

    &--with-switch {
      display: flex;
      align-items: center;
      padding: 0 var(--van-padding-base);
    }
  }

  &__header-subtitle-text {
    flex: 1;
  }

  &__header-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--van-calendar-header-action-width);
    height: 100%;
    color: var(--van-calendar-header-action-color);
    cursor: pointer;

    &--disabled {
      color: var(--van-calendar-header-action-disabled-color);
      cursor: not-allowed;
    }
  }

  &__month-title {
    font-size: var(--van-calendar-month-title-font-size);
  }

  &__weekdays {
    display: flex;
  }

  &__weekday {
    flex: 1;
    font-size: var(--van-calendar-weekdays-font-size);
    line-height: var(--van-calendar-weekdays-height);
    text-align: center;
  }

  &__body {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  &__days {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    user-select: none;
  }

  &__month-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    color: var(--van-calendar-month-mark-color);
    font-size: var(--van-calendar-month-mark-font-size);
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  &__day,
  &__selected-day {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  &__day {
    position: relative;
    width: 14.285%;
    height: var(--van-calendar-day-height);
    font-size: var(--van-calendar-day-font-size);
    margin-bottom: var(--van-calendar-day-margin-bottom);
    cursor: pointer;

    &--end,
    &--start,
    &--start-end,
    &--multiple-middle,
    &--multiple-selected {
      color: var(--van-calendar-range-edge-color);
      background: var(--van-calendar-range-edge-background);
    }

    &--start {
      border-radius: var(--van-radius-md) 0 0 var(--van-radius-md);
    }

    &--end {
      border-radius: 0 var(--van-radius-md) var(--van-radius-md) 0;
    }

    &--start-end,
    &--multiple-selected {
      border-radius: var(--van-radius-md);
    }

    &--middle {
      color: var(--van-calendar-range-middle-color);

      &::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background-color: currentColor;
        opacity: var(--van-calendar-range-middle-background-opacity);
        content: '';
      }
    }

    &--disabled {
      color: var(--van-calendar-day-disabled-color);
      cursor: default;
    }
  }

  &__top-info,
  &__bottom-info {
    position: absolute;
    right: 0;
    left: 0;
    font-size: var(--van-calendar-info-font-size);
    line-height: var(--van-calendar-info-line-height);

    @media (max-width: 350px) {
      font-size: 9px;
    }
  }

  &__top-info {
    top: 6px;
  }

  &__bottom-info {
    bottom: 6px;
  }

  &__selected-day {
    width: var(--van-calendar-selected-day-size);
    height: var(--van-calendar-selected-day-size);
    color: var(--van-calendar-selected-day-color);
    background: var(--van-calendar-selected-day-background);
    border-radius: var(--van-radius-md);
  }

  &__footer {
    flex-shrink: 0;
    padding-left: var(--van-padding-md);
    padding-right: var(--van-padding-md);
  }

  &__confirm {
    height: var(--van-calendar-confirm-button-height);
    margin: var(--van-calendar-confirm-button-margin);
  }
}
